home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 3 / Cream of the Crop 3.iso / utility / gwall26.zip / GWALL.REX < prev   
OS/2 REXX Batch file  |  1994-02-06  |  9KB  |  333 lines

  1. /*Graffiti Wall v2.6 by John Waters*/
  2.  
  3. parse arg UNAME','ALIAS','ACCESS','GFX','ASK .
  4. if compress(GFX) = '' then GFX = 'MONO'
  5.  
  6. if ~show('L',"rexxsupport.library") then do
  7.    if addlib('rexxsupport.library',0,-30,0) then
  8.       nop
  9.    else do
  10.       say 'Support library not available.'
  11.       exit 10
  12.       end
  13. end
  14.  
  15. signal on BREAK_C
  16. signal on FAILURE
  17. signal on SYNTAX
  18.  
  19. if upper(GFX)='MONO' then do
  20.    BLK='';RED=''
  21.    GRN='';YEL=''
  22.    BLU='';PUR=''
  23.    CYA='';WHT=''
  24.    BLURED='';REDWHT=''
  25.    BLUBAK='';REDBAK=''
  26.    REDBLU='';OFF='';CLS=''
  27. end
  28. else do
  29.    BLK='';RED=''
  30.    GRN='';YEL=''
  31.    BLU='';PUR=''
  32.    CYA='';WHT=''
  33.    BLURED='';REDWHT=''
  34.    BLUBAK='';REDBAK=''
  35.    REDBLU='';OFF='';CLS='H'
  36. end
  37.  
  38. if upper(ASK) ~= 'NOASK' then do
  39.    Say CLS
  40.    Say ''
  41.    call GetInput(RED'Read the Graffiti Wall ('YEL'Y'RED'/n)? 'OFF,1)
  42.    if upper(Ans)='N' then signal EndPro
  43. end
  44.  
  45. MultiSpray = 1      /* MultiSpray? 1=ON 0=OFF                              */
  46. AliasQ     = 1      /* Let users use aliases? 1=YES 0=NO                   */
  47. SysAcc     = 255    /* Sysop access level                                  */
  48. Lines      = 10     /* Number of Graffiti Wall Lines                       */
  49. NoAcc      = N      /* Will not let this access or lower spray on the wall */
  50.                     /* Set to 'N' if you don't want an access limit        */
  51. FileDir = 'Doors:'  /* Change this if you are using a different directory  */
  52. DirName = 'Wall'    /* Name of Graffiti Wall directory                     */
  53. File    = 'GWall'   /* Name of Graffiti Wall data file                     */
  54.  
  55. PKNclr = 1
  56. PKMclr = 1
  57. RdWall = 0
  58. Col    = 74
  59.  
  60. if ~exists(FileDir||DirName) then do
  61.     makedir(FileDir||DirName)
  62. end
  63. if ~exists(FileDir||DirName'/'||File) then do
  64.    do i=1 to Lines
  65.       Ran=Random(1,6,Time('s'))
  66.       if Ran=1 then c.i=''
  67.       if Ran=2 then c.i=''
  68.       if Ran=3 then c.i=''
  69.       if Ran=4 then c.i=''
  70.       if Ran=5 then c.i=''
  71.       if Ran=6 then c.i=''
  72.    end
  73.    call open(File,FileDir||DirName'/'||File,'W')
  74.    do i=1 to Lines
  75.       call writeln(File,c.i)
  76.       call writeln(File,c.i)
  77.       call writeln(File,'NONE')
  78.       call writeln(File,'John Waters')
  79.       call writeln(File,'The Graffiti Wall v2.6')
  80.    end
  81.    call close(File)
  82. end
  83.  
  84. call ReadWall
  85.  
  86. Read:
  87.   Say CLS
  88.   do i=1 to Lines
  89.      if Alias.i ~= 'NONE' then do
  90.         if Access>=SysAcc then RName.i='('Name.i')'
  91.         else RName.i=''           
  92.         Name.i=Alias.i
  93.      end
  94.      else Rname.i=''
  95.      if upper(GFX)='MONO' then do
  96.         Ncolor.i=''
  97.         Mcolor.i=''
  98.      end
  99.      Say Ncolor.i||Name.i RName.i
  100.      Say '     'Mcolor.i||BLUBAK||left(Message.i,col)OFF
  101.   end
  102.   if (RdWall) then do
  103.      call GetInput('Hit any key ',1)
  104.      Signal Choices
  105.   end
  106.   RdWall=1
  107.   if upper(NoAcc)='N' then Signal LastPerson
  108.   if Access<=NoAcc then do
  109.      call GetInput('Hit any key ',1)
  110.      signal EndPro
  111.   end
  112.  
  113. LastPerson:
  114.   LastPerson=Name.Lines
  115.   if upper(LastPerson)=upper(UNAME) then do
  116.      if (MultiSpray) then Signal Ask
  117.      call GetInput('Hit any key ',1)
  118.      signal EndPro
  119.   end
  120.  
  121. Ask:
  122.   Say ''
  123.   Call GetInput(PUR'Spray on the wall (y/'GRN'N'PUR')? 'OFF,1)
  124.   if upper(Ans)='Y' then Signal Input
  125.   signal EndPro
  126.  
  127. Input:
  128.   Say ''
  129.   Say CYA'  Spray can ready.  Go for it.'
  130.   Say GRN'<------------------------------------------------------------------------->'OFF
  131.   Call GetInput('>'OFF,col)
  132.   umessage = Ans
  133.   if compress(umessage)='' then signal EndPro
  134.   if (AliasQ) then do
  135.      Say ''
  136.      Call GetInput(BLU'Would you like to use an Alias (y/'YEL'N'BLU')? 'OFF,1)
  137.      if upper(Ans)='Y' then do
  138.         Say ''
  139.         Say GRN'What would you like your Alias to be?'
  140.         Call GetInput(BLU'['RED||Alias||BLU']> 'OFF,50)
  141.         Alias2=Ans
  142.         if compress(alias2)='' then Alias2=Alias
  143.         Signal Choices
  144.      end 
  145.   end
  146.   Alias2 = 'NONE'
  147.  
  148. Choices:
  149.   Say CLS
  150.   Say ''
  151.   Say '              'WHT' ___________________________________________________ 'OFF
  152.   Say '              'REDWHT'|___|___|___|___|___|___|___|___|___|___|___|___|___|'OFF
  153.   Say '              'REDWHT'|_|___|___|___|_'GRN'The_Graffitit_Wall_v2.6'WHT'___|___|___|_|'OFF
  154.   Say '              'REDWHT'|___|___|___|___|___'YEL'By_John_Waters'WHT'__|___|___|___|___|'OFF
  155.   Say '              'REDWHT'|_|___|___|___|___|___|___|___|___|___|___|___|___|_|'OFF
  156.   Say '              'REDWHT'|___|'BLU'['CYA'R'BLU']'CYA'estart_Your_Message'WHT'_|_'BLU'['CYA'V'BLU']'CYA'iew_Your_Message'WHT'___|'OFF
  157.   Say '              'REDWHT'|_|__'BLU'['CYA'L'BLU']'CYA'ook_At_Wall'WHT'___|___|___'BLU'['CYA'A'BLU']'CYA'bort_Your_Message'WHT'|_|'OFF
  158.   if upper(GFX)~='MONO' then do
  159.      Say '              'REDWHT'|___|'BLU'['CYA'N'BLU']'CYA'ame_Color'WHT'___|___|___|_'BLU'['CYA'M'BLU']'CYA'essage_Color'WHT'___|___|'OFF
  160.      Say '              'REDWHT'|_|___|___|___|___|___|___|___|___|___|___|___|___|_|'OFF
  161.   end
  162.   Say '              'REDWHT'|___|___|___|___|___|___|___|___|___|___|___|___|___|'OFF
  163.   Call GetInput('              'BLU'['GRN'Return To Save'BLU'] 'PUR'Pick One: 'OFF,1)
  164.   if upper(Ans) = 'R' then Signal Input
  165.   if upper(Ans) = 'L' then Signal Read
  166.   if upper(Ans) = 'M' then Signal PickMessageColor
  167.   if upper(Ans) = 'N' then Signal PickNameColor
  168.   if upper(Ans) = 'A' then Signal EndPro
  169.   if upper(Ans) = 'V' then Signal View
  170.   Signal Spray
  171.  
  172. View:
  173.   call color
  174.   if Alias2 ~= 'NONE' then uname1=Alias2
  175.   else uname1=uname
  176.   Say CLS
  177.   if upper(GFX)='MONO' then do 
  178.      Ncolor1=''
  179.      Mcolor1=''
  180.   end
  181.   else do
  182.      Ncolor1=Ncolor
  183.      Mcolor1=Mcolor
  184.   end
  185.   Say Ncolor1||uname1
  186.   Say '     'Mcolor1||BLUBAK||left(umessage,col)OFF
  187.   Say ''
  188.   call GetInput('Hit any key ',1)
  189.   Signal Choices
  190.  
  191. PickNameColor:
  192.   PKNclr='0'
  193.   Say CLS
  194.   Say ' '
  195.   Say '[1] - 'GRN'Green'
  196.   Say '[2] - 'CYA'Cyan'
  197.   Say '[3] - 'PUR'Purple'
  198.   Say '[4] - 'YEL'Yellow'
  199.   Say '[5] - 'RED'Red'
  200.   Say '[6] - 'WHT'White'
  201.   Say '[7] - 'BLU'Blue'OFF
  202.   Say ''
  203.   Call GetInput(BLU'Pick One (1-7)>'OFF,1)
  204.   if upper(Ans)='1' then NColor=''
  205.   if upper(Ans)='2' then NColor=''
  206.   if upper(Ans)='3' then NColor=''
  207.   if upper(Ans)='4' then NColor=''
  208.   if upper(Ans)='5' then NColor=''
  209.   if upper(Ans)='6' then NColor=''
  210.   if upper(Ans)='7' then NColor=''
  211.   if Ans <1 | Ans >7 then Signal PickNameColor
  212.   Signal Choices
  213.  
  214. PickMessageColor:
  215.   PKMclr='0'
  216.   Say CLS
  217.   Say ' '
  218.   Say '[1] - 'BLUBAK''GRN'Green 'OFF
  219.   Say '[2] - 'BLUBAK''CYA'Cyan  'OFF
  220.   Say '[3] - 'BLUBAK''PUR'Purple'OFF
  221.   Say '[4] - 'BLUBAK''YEL'Yellow'OFF
  222.   Say '[5] - 'BLUBAK''RED'Red   'OFF
  223.   Say '[6] - 'BLUBAK''WHT'White 'OFF
  224.   Say '[7] - 'BLUBAK''BLK'Black 'OFF
  225.   Say ' '
  226.   Call GetInput(BLU'Pick One (1-7)>'OFF,1)
  227.   if upper(Ans)='1' then MColor=''
  228.   if upper(Ans)='2' then MColor=''
  229.   if upper(Ans)='3' then MColor=''
  230.   if upper(Ans)='4' then MColor=''
  231.   if upper(Ans)='5' then MColor=''
  232.   if upper(Ans)='6' then MColor=''
  233.   if upper(Ans)='7' then MColor=''
  234.   if Ans <1 | Ans >7 then Signal PickMessageColor
  235.   Signal Choices
  236.  
  237. Spray:
  238.   InUse = GETCLIP('gwall')
  239.   If InUse = 'busy' then signal Spray
  240.   call SETCLIP('gwall','busy')
  241.   call color
  242.   call ReadWall
  243.   call open(File,FileDir||DirName'/'||File,'W')
  244.   do i = 2 to Lines
  245.      call writeln(File,Ncolor.i)
  246.      call writeln(File,Mcolor.i)
  247.      call writeln(File,alias.i)
  248.      call writeln(File,name.i)
  249.      call writeln(File,message.i)
  250.   end
  251.   call writeln(File,Ncolor)
  252.   call writeln(File,Mcolor)
  253.   call writeln(File,alias2)
  254.   call writeln(File,uname)
  255.   call writeln(File,umessage)
  256.   call close(File)
  257.   signal EndPro
  258.  
  259. ReadWall:
  260.   call open(File,FileDir||DirName'/'||File,'R')
  261.   do i=1 to Lines
  262.      Ncolor.i=readln(File)
  263.      Mcolor.i=readln(File)
  264.      Alias.i=readln(File)
  265.      Name.i=readln(File)
  266.      Message.i=readln(File)
  267.   end
  268.   call close(File)
  269.   return
  270.  
  271. Color:
  272.   if (PKMclr) then do
  273.      Ran=Random(1,7,Time('s'))
  274.      if Ran=1 then Mcolor=''
  275.      if Ran=2 then Mcolor=''
  276.      if Ran=3 then Mcolor=''
  277.      if Ran=4 then Mcolor=''
  278.      if Ran=5 then Mcolor=''
  279.      if Ran=6 then Mcolor=''
  280.      if Ran=7 then Mcolor=''
  281.   end
  282.   if (PKNclr) then do
  283.      Ran=Random(1,7,Time('s'))
  284.      if Ran=1 then Ncolor=''
  285.      if Ran=2 then Ncolor=''
  286.      if Ran=3 then Ncolor=''
  287.      if Ran=4 then Ncolor=''
  288.      if Ran=5 then Ncolor=''
  289.      if Ran=6 then Ncolor=''
  290.      if Ran=7 then Ncolor=''
  291.   end
  292.   return
  293.  
  294. break_c:
  295. error:
  296. failure:
  297. SYNTAX:
  298.   Say ''
  299.   Say '*Hmmm, Looks like we got an Error in the Graffiti Wall.*'
  300.   Say '*Please tell the Sysop.*'
  301.   Say '*Line:' SIGL '   Error Code:' RC'*'
  302.   signal EndPro
  303.  
  304. GetInput:
  305.   parse arg Question,Len
  306.   Ans=''
  307.   call writech(stdout,Question)
  308.   do i = 1 to Len until char = '0d'x
  309.      char = readch(stdin,1)
  310.      call writech(stdout,char)
  311.      Ans = Ans||char
  312.      if char == '08'x then do
  313.         if ans=='08'x then do
  314.            writech(stdout,' ')
  315.            i=i-1
  316.            Ans=left(ans,length(ans)-1)
  317.         end
  318.         else do
  319.            writech(stdout,' '||'08'x)
  320.            i=i-2
  321.            Ans=left(ans,length(ans)-2)
  322.         end
  323.      end
  324.   end
  325.   if ans='0d'x then say
  326.   if right(ans,1)='0d'x then ans=left(ans,length(ans)-1)
  327.   Return
  328.  
  329. EndPro:
  330.   call SETCLIP('gwall')
  331.   Say OFF
  332.   exit
  333.